package com.example.app2024.boardcast;

import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class MyReceiver extends BroadcastReceiver
{
      /**
       * 运行于主线程
       * @param context The Context in which the receiver is running.
       * @param intent The Intent being received.
       */
      @Override
      public void onReceive(Context context, Intent intent)
      {

            if (intent != null)
            {
                  Log.i("TAG", "onReceive:有意图" + intent.getAction());
                  if (intent.getAction().equals(myboardcastActivity.MY_ACTION))  //一定要判断
                  {
                        Toast.makeText(context.getApplicationContext(), intent.getStringExtra("myzxj"), Toast.LENGTH_SHORT).show();
                  }

            }
            else
            {
                  Log.i("TAG", "onReceive: 无意图");
                  Toast.makeText(context.getApplicationContext(), "ffffff", Toast.LENGTH_SHORT).show();
            }
      }
}